package com.example.jvmdemo.org.fenixsoft.jvm.test;

import lombok.Data;

import java.util.HashMap;
import java.util.Map;

@Data
public class A {
    private String s;
    private int i=11;
    public int hashCode(){
        return i;
    }

    public static void main(String[] args) {
        A a1=new A();
        a1.setI(22);
        A a3=new A();
        a3.setI(33);
        HashMap<A,String> map=new HashMap<>();
        map.put(new A(),"1");
        map.put(new A(),"2");
        map.put(new A(),"3");
        map.put(a1,"3");
        map.get(a1);
        map.put(a3,"4");
        for (Map.Entry<A,String> entry:
                map.entrySet()
             ) {
            System.out.println(entry.getKey()+": "+entry.getValue());
        }
        A a2=new A();
        System.out.println(a1==a2);
    }

}
